﻿using System;
using System.Drawing;
using System.Windows.Forms;

namespace YJKFamilyFindder.YJKFamilyFindder
{
	public class TitleTextBox : System.Windows.Forms.TextBox
	{
		protected override void WndProc(ref Message m)
		{
			base.WndProc(ref m);
			if (m.Msg == 15)
			{
				if (this.Text.CompareTo("") != 0)
				{
					return;
				}
				Graphics graphics = Graphics.FromHwnd(base.Handle);
				SolidBrush brush = new SolidBrush(System.Drawing.Color.LightGray);
				System.Drawing.Rectangle clientRectangle = base.ClientRectangle;
				StringFormat stringFormat = new StringFormat();
				stringFormat.Alignment = StringAlignment.Near;
				stringFormat.LineAlignment = StringAlignment.Center;
				graphics.DrawString("键入关键词，以“\\”或“/”分隔", this.Font, brush, clientRectangle, stringFormat);
				graphics.Dispose();
			}
		}
	}
}
